<!DOCTYPE html>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<style>
  rect {
    fill: red;
  }
</style>
<svg width="100" height="100">
  <g>
    <use xlink:href="#r"></use>
  </g>
  <defs>
    <rect id="r" x="0" y="0" width="100" height="100"></rect>
  </defs>
</svg>
<script>
runAfterLayoutAndPaint(function() {
  r.style.fill = 'green';
}, true);
</script>
